/*
 * job.h
 *
 *  Created on: Jun 22, 2011
 *      Author: Gilad & Yotam
 */

#ifndef JOB_H_
#define JOB_H_

#include <exception>
#include "matrix.h"

class Job {
	int id;
	int priority;

	static void validatePriority(int priority);
protected:
	Matrix a;
	Matrix b;
public:
	class JobExceptions: public std::exception {};
	class JobFailed: public JobExceptions {};
	class InvalidJobPriority: public JobExceptions {};

	class CompareId {
		int id;
	public:
		CompareId(int id) : id(id) {}
		bool operator()(const int& x) const
		{
			return x == id;
		}
	};

	Job(int id, int priority, const Matrix& a, const Matrix& b);
	virtual ~Job();
	void changePriority(int newPriority);
	int getId();
	int getPriority();
	virtual Matrix execute() = 0;
};

#endif /* JOB_H_ */
